package com.fivenations.relax;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Spinner;

public class EventFormActivity extends Activity {

	/*private Spinner spinner1, spinner2;
	private Button btnSave;*/
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.event_form);
        
    }
    
	public void onGobacktoMain (View view){
		Intent i = new Intent(view.getContext(), MainActivity.class);
		this.startActivity(i);
	}
    
	public void Adddate(View view){
		DBAdapter db = new DBAdapter(this);
		// database variables
		String title;
		String date;
		String time;
		String location;
		
		EditText edittext1 = (EditText)findViewById(R.id.Edt_title);
		EditText edittext2 = (EditText)findViewById(R.id.Edt_date);
		EditText edittext3 = (EditText)findViewById(R.id.Edt_time);
		
		Spinner mySpinner = (Spinner)findViewById(R.id.spinner1);

		
		title = edittext1.getText().toString();
		date = edittext2.getText().toString();
		time = edittext3.getText().toString();
		location = mySpinner.getSelectedItem().toString();
		
		//open database
		db.open();
		//inset into database
		db.insertRecord(title, date, time, location);
		//close
		db.close();
			
		//back to Main Activity
		onGobacktoMain(null);
	

	}
	
}